/*
 * @(#)GoldPalette.java	0.1 2002-06-26
 * 
 * Copyleft 2002 Wonseok Shin, Taeksoo Jung
 * Anyone can get benefits from this.
 */
package cs348a.color;

/**
 * A <code>GoldPalette</code> defines a gold palette.
 * 
 * @version	0.1
 * @author		Wonseok Shin, Taeksoo Jung
 * @since		0.1
 */
public final class GoldPalette extends BasicPalette {
	/** Singleton instance */
	public static final GoldPalette INSTANCE = getInstance();
	
	/**
	 * Constructor for <code>GoldPalette</code>.
	 * 
	 * @param reds array of red components
	 * @param greens array of green components
	 * @param blues array of blue components
	 */
	private GoldPalette(byte[] reds, byte[] greens, byte[] blues) {
		super("Gold", reds, greens, blues);
	}
	
	/**
	 * Returns the singleton instance.
	 * 
	 * @return the singleton instance
	 */
	private static GoldPalette getInstance() {
		// Creates arrays of components.
		byte[] reds = new byte[SIZE];
		byte[] greens = new byte[SIZE];
		byte[] blues = new byte[SIZE];

		// Constructs the components.
		for (int i = 0; i < SIZE; i++) {
			// Sets the red component.
			double f = i * 2;
			reds[i] = cutOff(f);
			
			// Sets the green component.
			f = i * 2 - SIZE / 2;
			greens[i] = cutOff(f);
			
			// Sets the blue component.
			f = i * 2 - SIZE;
			blues[i] = cutOff(f);
		}
		
		return new GoldPalette(reds, greens, blues);
	}
}
